package com.foxconn.AppDownload.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zengdong
 * @version 1.0
 * @date 2024/1/4 14:40
 */
@Configuration
public class AccessInterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 1.  registry.addInterceptor(new LoginInterceptor())       注册登录拦截器
        // 2.  addPathPatterns("/**")                                拦截器拦截所有地址
        // 3.  excludePathPatterns(excludes)                         指定不被拦截的路径
        InterceptorRegistration interceptorRegistration = registry.addInterceptor(new LoginInterceptor());//登录拦截器
        interceptorRegistration.addPathPatterns("/**");
        interceptorRegistration.excludePathPatterns("/login1","/login","/index","/","/image/**","/jquery/**","/hp.html");
    }

}
